/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sdr;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import sdr.elementos.*;

/**
 *
 * @author stevenlizarazo
 */
public class HibernateUtil {

     static final SessionFactory sessionFactory = buildSessionFactory();

   private static org.hibernate.SessionFactory buildSessionFactory() {
        try {
            org.hibernate.cfg.AnnotationConfiguration a =new AnnotationConfiguration().configure();
            a.addAnnotatedClass(usuario.class);
            a.addAnnotatedClass(reporte_pos.class);
            a.addAnnotatedClass(perfiles.class);
            a.addAnnotatedClass(tipo_de_interes.class);
            SessionFactory   s=  a.buildSessionFactory();
           return s;
        }
        catch (Throwable ex) {
            System.err.println("Initial SessionFactory creation failed." + ex);
            throw new ExceptionInInitializerError(ex);
        }
    }

    public static SessionFactory getSessionFactory() {
        
        
        return sessionFactory;
    }

}
